from django.contrib import admin
from backend.models import PlatformLink,RedisConfig,PathConfig,ProjectName

# Register your models here.

class PlatformLinkAdmin(admin.ModelAdmin):
	list_display = ['id','name','link','environment','application']
	# list_per_page设置每页显示多少条记录，默认是100条
	list_per_page = 50
	# list_editable 设置默认可编辑字段
	#list_editable = ['name', 'link']
admin.site.register(PlatformLink,PlatformLinkAdmin)


class RedisConfigAdmin(admin.ModelAdmin):

	list_display = ['id','project','redisname','hostname','hostip','port','auth','environment']
	list_per_page = 50
	#帅选器
	list_filter =['project'] #过滤器，必须是列表或者元组
	#search_fields =('project', 'hostname', 'hostip') #搜索字段,必须是表里存在的列
	# date_hierarchy = 'create_time'   #必须是时间
admin.site.register(RedisConfig,RedisConfigAdmin)

class PathConfigAdmin(admin.ModelAdmin):

	list_display = ['id','pathname']
	list_per_page = 50

admin.site.register(PathConfig,PathConfigAdmin)

class ProjectNameAdmin(admin.ModelAdmin):

	list_display = ['id','projectname']
	list_per_page = 50

admin.site.register(ProjectName,ProjectNameAdmin)